namespace Turtle
{
    /// <summary>
    /// Position is a Value Object
    /// </summary>
    public class Position
    {
        public int X { get; private set; }
        public int Y { get; private set; }

        public Position(int x, int y)
        {
            X = x;
            Y = y;
        }

        public override bool Equals(object obj)
        {

            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }

            var pos = obj as Position;

            return X.Equals(pos.X) && Y.Equals(pos.Y);
            
        }

        public override int GetHashCode()
        {
            return X.GetHashCode() + Y.GetHashCode();
        }

        public override string  ToString()
        {
            return string.Format("({0},{1})", X, Y);
        }
    }
}